package com.taokatao.cardmee.db.model;

import android.text.TextUtils;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;

/**
 * Created by LY on 2016/9/12.
 */

@Entity
public class Message extends DBModel {
    /**
     * 消息id
     */
    @Id private Long id;

    @Property(nameInDb = "MESSAGE_ID") private Long messageId;

    /**
     * 分店id
     */
    @Property(nameInDb = "S_ID") private Long sid;

    /**
     * 分店名称
     */
    @Property(nameInDb = "S_NAME") private String sname;

    /**
     * 消息标题
     */
    @Property(nameInDb = "TITLE") private String messageTitle;

    /**
     * 消息内容
     */
    @Property(nameInDb = "MESSAGE") private String message;

    /**
     * 消息图片url
     */
    @Property(nameInDb = "PIC_URL") private String picUrl;

    /**
     * 时间戳(预留做增量更新) int(14位)
     */
    @Property(nameInDb = "TIMESTAMP") private Long timeStamp;


    /**
     * 已读未读  1已读
     */
    @Property(nameInDb = "HAD_READ") private Integer hadRead;
    public static final int READ_UNREAD = 0;
    public static final int READ_READ = 1;

    /**
     * 动作
     */
    @Property(nameInDb = "ACTION") private String action;

    /**
     * 类型(1 系统， 0商家)
     */
    @Property(nameInDb = "MESSAGE_TYPE") private Integer mMessageType;
    public static final int MESSAGE_TYPE_SYS = 1;
    public static final int MESSAGE_TYPE_BUSINESS = 0;

    @Property(nameInDb = "CREATE_TIME") private Long createTime;




    @Generated(hash = 345833822)
    public Message(Long id, Long messageId, Long sid, String sname,
            String messageTitle, String message, String picUrl, Long timeStamp,
            Integer hadRead, String action, Integer mMessageType, Long createTime) {
        this.id = id;
        this.messageId = messageId;
        this.sid = sid;
        this.sname = sname;
        this.messageTitle = messageTitle;
        this.message = message;
        this.picUrl = picUrl;
        this.timeStamp = timeStamp;
        this.hadRead = hadRead;
        this.action = action;
        this.mMessageType = mMessageType;
        this.createTime = createTime;
    }

    @Generated(hash = 637306882)
    public Message() {
    }


    

    /**
     * 复制排序字段以外的属性值
     */
    public void refreshProperties(Message newProperties) {
        this.messageId = newProperties.messageId;
        this.sid = newProperties.sid;
        this.sname = newProperties.sname;
        this.messageTitle = newProperties.messageTitle;
        this.message = newProperties.message;
        this.picUrl = newProperties.picUrl;
        this.timeStamp = newProperties.timeStamp;
        // this.hadRead = newProperties.hadRead;  // hadRead 除外
        this.action = newProperties.action;
        this.mMessageType = newProperties.mMessageType;
    }

    @Override
    public boolean equals(Object o) {
        if (o != null && o instanceof Message) {
            Message other = (Message) o;
            if (messageId != null && other.messageId != null &&
                    messageId.longValue() == other.messageId.longValue()) {
                return true;
            }
        }
        return false;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMessageId() {
        return this.messageId;
    }

    public void setMessageId(Long messageId) {
        this.messageId = messageId;
    }

    public Long getSid() {
        return this.sid;
    }

    public void setSid(Long sid) {
        this.sid = sid;
    }

    public String getSname() {
        return this.sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    public String getMessageTitle() {
        return this.messageTitle;
    }

    public void setMessageTitle(String messageTitle) {
        this.messageTitle = messageTitle;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getPicUrl() {
        return this.picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public Long getTimeStamp() {
        return this.timeStamp;
    }

    public void setTimeStamp(Long timeStamp) {
        this.timeStamp = timeStamp;
    }

    public String getAction() {
        return this.action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public Integer getMMessageType() {
        return this.mMessageType;
    }

    public void setMMessageType(Integer mMessageType) {
        this.mMessageType = mMessageType;
    }

    public Long getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Integer getHadRead() {
        return this.hadRead;
    }

    public void setHadRead(Integer hadRead) {
        this.hadRead = hadRead;
    }




}
